nested vmx: fix I/O port bitmap indexing arithmetic
authorMatthew Daley <mattd@bugfuzz.com>
Tue, 3 Dec 2013 08:51:54 +0000 (09:51 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 3 Dec 2013 08:51:54 +0000 (09:51 +0100)
The I/O port bitmap holds 8 ports per element, and hence the port number
used when indexing into it should be shifted right by 3 bits, not 4.

Signed-off-by: Matthew Daley <mattd@bugfuzz.com>
Reviewed-by: Yang Zhang <yang.z.zhang@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
xen/arch/x86/hvm/vmx/vvmx.c

index 248e97586a9fc249ea6256d3ec327235f26dc768..7fa110e5851b522740be7b6145e711e686590d24 100644 (file)
@@ -2225,7 +2225,7 @@ int nvmx_n2_vmexit_handler(struct cpu_user_regs *regs,
             __vmread(EXIT_QUALIFICATION, &qual);
             port = qual >> 16;
             bitmap = nvmx->iobitmap[port >> 15];
-            if ( bitmap[(port & 0x7fff) >> 4] & (1 << (port & 0x7)) )
+            if ( bitmap[(port & 0x7fff) >> 3] & (1 << (port & 0x7)) )
                 nvcpu->nv_vmexit_pending = 1;
             if ( !nvcpu->nv_vmexit_pending )
                gdprintk(XENLOG_WARNING, "L0 PIO %x.\n", port);